//Set working directory and import data file
cd "/Users/gabriellelevy/OneDrive - Dartmouth College/Replication Files/Nunn and Qian"
clear
import excel levy_nunn&qian.xlsx, firstrow
save levy_nunn&qian.dta, replace


//REPLICATING NUNN & QIAN RESULTS 
capture log close
set more off
set matsize 7000
set scheme s1mono


*********************************
*** TABLE 7: Onset & Duration ***
*********************************

use "levy_nunn&qian.dta", clear
tsset obs year

gen l_intra_state=l.intra_state
gen l_any_war=l.any_war

/* Converting wheat aid measure & production to thousands of tonnes - coefficients are easier to read */
replace wheat_aid=wheat_aid/1000 	
replace US_wheat_production=US_wheat_production/1000

gen instrument=l.US_wheat_production*fadum_avg
la var instrument "Baseline interaction instrument: US wheat prod (t-1) x avg food aid prob (1971-2006)"

/* Dropping years outside of the sample period */
drop if year<1971
drop if year>2006

/* Generating continent indicators, year indicators, and their interactions so that we don't have to use time-series operators -- they take longer for stata to compute */
gen cont=.
replace cont=1 if wb_region=="East Asia & Pacific"
replace cont=2 if wb_region=="Europe & Central Asia"
replace cont=3 if wb_region=="Latin America & Caribbean"
replace cont=4 if wb_region=="Middle East & North Africa"
replace cont=5 if wb_region=="South Asia"
replace cont=6 if wb_region=="Sub-Saharan Africa"

tab cont, gen(contdum)
tab year, gen(ydum)
tab risocode, gen(cdum)

forval x=1/36{
	gen cont1_y`x'=contdum1*ydum`x'
}
forval x=1/36{
	gen cont2_y`x'=contdum2*ydum`x'
}
forval x=1/36{
	gen cont3_y`x'=contdum3*ydum`x'
}
forval x=1/36{
	gen cont4_y`x'=contdum4*ydum`x'
}
forval x=1/36{
	gen cont5_y`x'=contdum5*ydum`x'
}
forval x=1/36{
	gen cont6_y`x'=contdum6*ydum`x'
}
forval x=1/36{
	gen rcereal_y`x'=recipient_pc_cereals_prod_avg*ydum`x'
}
forval x=1/36{
	gen rimport_y`x'=cereal_pc_import_quantity_avg*ydum`x'
}
forval x=1/36{
	gen usec_y`x'=real_us_nonfoodaid_ecaid_avg*ydum`x'
}
forval x=1/36{
	gen usmil_y`x'=real_usmilaid_avg*ydum`x'
}

gen USA_ln_income = ln(USA_rgdpch)

bysort risocode: egen ln_rgdpch_avg=mean(ln_rgdpch) if year>=1971 & year<=2006

forval x=1/36{
	gen gdp_y`x'=ln_rgdpch_avg*ydum`x'
}
gen oil_fadum_avg=oil_price_2011_USD*fadum_avg
gen US_income_fadum_avg=USA_ln_income*fadum_avg
gen US_democ_pres_fadum_avg=US_president_democ*fadum_avg

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"

/* Generating in-sample indicator so that all specifications have the same number of observations */
qui: xi: ivreg2 intra_state (wheat_aid=instrument) `baseline_controls' i.risocode i.year*i.wb_region if year>=1971 & year<=2006, cluster(risocode)
gen in_sample=1 if e(sample)==1

*** Duration models: for conflict -> peace (offset) - using control function approach for IV ***
* Marginal effects are reported. These are not exported using outreg. To see these please look at the log file

drop if l_intra_state==0	/* Only at risk of offset if last year were at war */
gen intra_state_dur2=intra_state_dur*intra_state_dur
gen intra_state_dur3=intra_state_dur2*intra_state_dur
xi: reg wheat_aid instrument intra_state_dur intra_state_dur2 intra_state_dur3 `controls' i.wb_region if missing(intra_state_offset)!=1, cluster(risocode)
test instrument
predict aid_hat if e(sample)==1, resid

//* Col 8: Duration: 
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region, cluster(risocode)



//NSTAR SUBSET ANALYSIS (data for Table 8)
destring epr_nstar, replace
sum epr_nstar, d
kdensity epr_nstar
cumul epr_nstar, gen(nstar_pctl) equal

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region, cluster(risocode) // original

//subsetting
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl<0.4 & nstar_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl>0.4 & nstar_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl<0.5 & nstar_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl>0.5 & nstar_pctl!=., cluster(risocode) 
 
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl<0.6 & nstar_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl>0.6 & nstar_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl<0.7 & nstar_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl>0.7 & nstar_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl<0.8 & nstar_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if nstar_pctl>0.8 & nstar_pctl!=., cluster(risocode) 


//ETHNIC WAR SUBSET ANALYSIS (data for Table 8)
destring ethnic_war, replace

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if ethnic_war==0, cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if ethnic_war==1, cluster(risocode)


//SUBSET ANALYSES FOR ADDITIONAL ETHNIC DIVIDES VARIABLES (exclpop, discrimpop, hief)
//exclpop (data for Table B6)
destring epr_exclpop, replace
sum epr_exclpop, d
kdensity epr_exclpop
cumul epr_exclpop, gen(exclpop_pctl) equal

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl<0.4 & exclpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl>0.4 & exclpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl<0.5 & exclpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl>0.5 & exclpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl<0.6 & exclpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl>0.6 & exclpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl<0.7 & exclpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl>0.7 & exclpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl<0.8 & exclpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if exclpop_pctl>0.8 & exclpop_pctl!=., cluster(risocode)

//discrimpop (data for Table B9)
destring epr_discrimpop, replace
sum epr_discrimpop, d
kdensity epr_discrimpop
cumul epr_discrimpop, gen(discrimpop_pctl) equal

//local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
//local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
//xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl<0.4 & discrimpop_pctl!=., cluster(risocode) //insufficient data

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl>0.4 & discrimpop_pctl!=., cluster(risocode)

//local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
//local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
//xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl<0.5 & discrimpop_pctl!=., cluster(risocode) //insufficient data

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl>0.5 & discrimpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl<0.6 & discrimpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl>0.6 & discrimpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl<0.7 & discrimpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl>0.7 & discrimpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl<0.8 & discrimpop_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if discrimpop_pctl>0.8 & discrimpop_pctl!=., cluster(risocode)

//hief (data for Table B12)
destring hief_ef, replace
sum hief_ef, d
kdensity hief_ef
cumul hief_ef, gen(hief_pctl) equal

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl<0.4 & hief_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl>0.4 & hief_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl<0.5 & hief_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl>0.5 & hief_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl<0.6 & hief_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl>0.6 & hief_pctl!=., cluster(risocode)  

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl<0.7 & hief_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl>0.7 & hief_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl<0.8 & hief_pctl!=., cluster(risocode) 

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if hief_pctl>0.8 & hief_pctl!=., cluster(risocode) 

//ETHNIC DIVIDES INTERACTION ANALYSES
//Table A7: Nunn and Qian – Ethnic Divides Interaction Analysis
//original
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region, cluster(risocode)  
outreg2 using tableA7.doc, replace ctitle(Original)
//nstar
gen nstar_x_aid=epr_nstar*wheat_aid
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit  intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region nstar_x_aid epr_nstar, cluster(risocode)
outreg2 using tableA7.doc, append ctitle(Nstar)
//ethnic war
gen ethnic_war_x_aid=ethnic_war*wheat_aid
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit  intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region ethnic_war_x_aid ethnic_war, cluster(risocode)
outreg2 using tableA7.doc, append ctitle(Ethnic War)

//Table B3: Nunn and Qian – Ethnic Divides Interaction Analysis (full)
//original
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region, cluster(risocode)  
outreg2 using tableB3.doc, replace ctitle(Original)
//ethnic war
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit  intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region ethnic_war_x_aid ethnic_war, cluster(risocode)
outreg2 using tableB3.doc, append ctitle(Ethnic War)
//nstar 
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit  intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region nstar_x_aid epr_nstar, cluster(risocode)
outreg2 using tableB3.doc, append ctitle(Nstar)
//other variables
//exclpop
gen exclpop_x_aid=epr_exclpop*wheat_aid
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region exclpop_x_aid epr_exclpop , cluster(risocode)
outreg2 using tableB3.doc, append ctitle(Exclpop)
//discrimpop
gen discrimpop_x_aid=epr_discrimpop*wheat_aid
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region  discrimpop_x_aid epr_discrimpop , cluster(risocode)
outreg2 using tableB3.doc, append ctitle(Discrimpop)
//hief
gen hief_x_aid=hief_ef*wheat_aid
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit  intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region  hief_x_aid hief_ef, cluster(risocode)
outreg2 using tableB3.doc, append ctitle(Hief)

//CORRUPTION SUBSET AND INTERACTION ANALYSES
destring v2x_corr, replace
cumul v2x_corr, gen(corr_pctl) equal

//subset analysis (data for Table 9)
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl<0.4 & corr_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl>0.4 & corr_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl<0.5 & corr_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl>0.5 & corr_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl<0.6 & corr_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl>0.6 & corr_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl<0.7 & corr_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl>0.7 & corr_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl<0.8 & corr_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if corr_pctl>0.8 & corr_pctl!=., cluster(risocode)

//interaction analysis
//Table A8: Nunn and Qian – Corruption Interaction Analysis
//original
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region, cluster(risocode)  
outreg2 using tableA8.doc, replace ctitle(Original)
//corruption
gen corr_x_aid=v2x_corr*wheat_aid
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit  intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region corr_x_aid v2x_corr, cluster(risocode)
outreg2 using tableA8.doc, append ctitle(v2x_corr)


//STATE CAPACITY SUBSET AND INTERACTION ANALYSES
destring capacity, replace
cumul capacity, gen(capacity_pctl) equal

//subset analysis (data for Table 10)
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl<0.4 & capacity_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl>0.4 & capacity_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl<0.5 & capacity_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl>0.5 & capacity_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl<0.6 & capacity_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl>0.6 & capacity_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl<0.7 & capacity_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl>0.7 & capacity_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl<0.8 & capacity_pctl!=., cluster(risocode)

local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region if capacity_pctl>0.8 & capacity_pctl!=., cluster(risocode)


//interaction analysis 
//Table A9: Nunn and Qian – State Capacity Interaction Analysis
//original
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region, cluster(risocode)  
outreg2 using tableA9.doc, replace ctitle(Original)
//capacity
gen capacity_x_aid=capacity*wheat_aid
local baseline_controls "oil_fadum_avg US_income_fadum_avg US_democ_pres_fadum_avg gdp_y2-gdp_y36 usmil_y2-usmil_y36 usec_y2-usec_y36 rcereal_y2-rcereal_y36 rimport_y2-rimport_y36 all_Precip_jan-all_Precip_dec all_Temp_jan-all_Temp_dec all_Precip_jan_faavg-all_Precip_dec_faavg all_Temp_jan_faavg-all_Temp_dec_faavg"
local dur_controls "real_usmilaid_avg real_us_nonfoodaid_ecaid_avg recipient_pc_cereals_prod_avg cereal_pc_import_quantity_avg ln_rgdpch_avg"
xi: logit  intra_state_offset wheat_aid aid_hat intra_state_dur intra_state_dur2 intra_state_dur3 `dur_controls' i.wb_region capacity_x_aid capacity, cluster(risocode)
outreg2 using tableA9.doc, append ctitle(capacity)




